package cn.edu.neu.service.impl;
import java.util.List;

import cn.edu.neu.dao.UserDao;
import cn.edu.neu.model.Category;
import cn.edu.neu.model.User;
import cn.edu.neu.service.UserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 用户Service接口实现类
 */
@Service("userService")
@Transactional
public class UserServiceImpl implements UserService {
	// 注入UserDao
	@Autowired
	private UserDao userDao;
	// 通过账号和密码查询用户
	@Override
	public User findUser(String usercode, String password) {
		User user = userDao.findUser(usercode, password);
		return user;
	}
	@Override
	public List getUserlist() {
		List list=userDao.getUserlist();
		return list;
	}

	@Override
	public PageInfo<User> FindUserListForPage(Integer page, Integer count) {
		PageHelper.startPage(page,count);
		List<User> list=userDao.selectUserListWithPage();
		PageInfo<User> pageInfo=new PageInfo<>(list);
		return pageInfo;
	}

	//删除商品分类信息
	@Override
	public int deleteUser_108(Integer user_id) {
		return userDao.deleteUser_108(user_id);
	}

	//更新商品分类信息
	@Override
	public int updateUser108(User user) {
		System.out.println("======category==="+user);
		return userDao.updateUser108(user);
	}

	@Override
	public int createUser108(User user) {
		int i=userDao.insertUser108(user);
		return i;
	}

//	@Override
//	public int createUser(User user) {
//
//		return userDao.insertUser(user);
//	}


}
